package com.ayf.payment.game.api.service.impl;

import com.ayf.payment.game.api.entity.GamePlayerGatewayConfig;
import com.ayf.payment.game.api.mapper.GamePlayerGatewayConfigMapper;
import com.ayf.payment.game.api.service.GamePlayerGatewayConfigService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class GamePlayerGatewayConfigServiceImpl implements GamePlayerGatewayConfigService {

    @Resource
    private GamePlayerGatewayConfigMapper gamePlayerGatewayConfigMapper;

    @Override
    public List<GamePlayerGatewayConfig> listByMerchantId(Integer id) {
        GamePlayerGatewayConfig gamePlayerGatewayConfig = new GamePlayerGatewayConfig();
        gamePlayerGatewayConfig.setMerchantId(id);
        return gamePlayerGatewayConfigMapper.select(gamePlayerGatewayConfig);
    }

    @Override
    public boolean add(GamePlayerGatewayConfig config) {
        return gamePlayerGatewayConfigMapper.insertSelective(config) > 0;
    }

    @Override
    public boolean update(GamePlayerGatewayConfig config) {
        return gamePlayerGatewayConfigMapper.updateByPrimaryKeySelective(config) > 0;
    }

    @Override
    public boolean del(GamePlayerGatewayConfig config) {
        return gamePlayerGatewayConfigMapper.delete(config) > 0;
    }

    @Override
    public GamePlayerGatewayConfig getById(Integer id) {
        return gamePlayerGatewayConfigMapper.selectByPrimaryKey(id);
    }

    @Override
    public GamePlayerGatewayConfig findByIp(String ip) {
        GamePlayerGatewayConfig gamePlayerGatewayConfig = new GamePlayerGatewayConfig();
        gamePlayerGatewayConfig.setIp(ip);
        return gamePlayerGatewayConfigMapper.selectOne(gamePlayerGatewayConfig);
    }
}



